home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
msqc25t1
/
windemo.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-23
|
3KB
|
85 lines
/* windemo.c: Shows windowing and screen save/restore. */
#include <conio.h>
#include <graph.h>
#include "textscrn.h"
/* DEFINE TYPES */
typedef struct { /* window descriptor */
int t, l, b, r;
char image [800];
} WINDESCR;
/* GLOBAL WINDOW DESCRIPTORS */
WINDESCR w [] = {
{ 10, 10, 20, 20},
{ 5, 40, 15, 70},
{ 12, 22, 17, 55}
};
/* LOCAL FUNCTION PROTOTYPES */
void prompt (char*);
int space (int, int, int, int);
void fillwin (int);
/*----------------------------*/
main()
{
int n;
_outtextf ("This is at row %d, column %d", n, n);
_clearscreen (_GCLEARSCREEN); /* clear the screen */
_outtextf ("This is at row %d, column %d", n, n);
_settextcolor (BROWN);
for (n = 1; n < 23; n++) { /* write some backgrnd text */
_settextposition (n, n);
_outtextf ("This is at row %d, column %d", n, n);
}
for (n = 0; n < 3; n++) { /* loop for three windows */
prompt ("Press any key for next window");
_savescrn (0); /* save screen */
_settextwindow (w[n].t, w[n].l,
w[n].b, w[n].r);
fillwin (n); /* fill window */
}
for (n = 2; n >= 0; n--) { /* step back erasing */
prompt ("Press any key to erase last window");
_restscrn (0); /* LIFO restore */
}
prompt ("Press any key to quit");
_settextcolor (LTGRAY);
_clearscreen (_GCLEARSCREEN); /* clear the screen */
} /*---------------------------------*/
void prompt (char *mssg)
/* Write prompt message at bottom of scrn and wait */
{
_settextwindow (1, 1, 25, 80); /* use whole screen */
_settextposition (24, 1); /* go to prompt line */
_settextcolor (WHITE);
_setbkcolor (0L);
_cleareol(); /* clear line */
_outtext (mssg); /* write message */
getch(); /* hold until key pressed */
} /*---------------------------------*/
void fillwin (int number)
/* Fill active window with scrolling text */
{
int i, c;
_clearscreen (_GWINDOW); /* clear active window */
_settextcolor (number + 1); /* blue, green cyan */
for (i=0; i<30; i++)
for (c = 33; c<127; c++) /* print all chars */
_outch (c);
} /*---------------------------------*/